import axios from '@/request'

export function getRuleListApi(page) {
  return axios.get(`/admin/rule/${page}`)
}

export function createRuleApi(data) {
  return axios.post('/admin/rule', data)
}

export function updateRuleApi(id, data) {
  return axios.post('/admin/role/' + id, data)
}

export function updateRuleStatusApi(id, status) {
  return axios.post(`/admin/role/${id}/update_status`, {
    status,
  })
}

export function deleteRuleApi(id) {
  return axios.post(`/admin/rule/${id}/delete`)
}

export function setRoleRulesApi(id, rule_ids) {
  return axios.post(`/admin/role/set_rules`, {
    id,
    rule_ids,
  })
}
